<!-- HTML header for doxygen 1.8.10-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.3"/>
<title>NATS C Client with JetStream and Streaming support: Subscription</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="customdoxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;" >
   <div id="projectname">NATS C Client with JetStream and Streaming support
   &#160;<span id="projectnumber">3.3.0</span>
   </div>
   <div id="projectbrief">The nats.io C Client, Supported by Synadia Communications Inc.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.3 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__sub_group.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">Subscription<div class="ingroups"><a class="el" href="group__func_group.html">Functions</a></div></div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga38f1e41fc7619101fc4aa52014dd5428"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga38f1e41fc7619101fc4aa52014dd5428">natsSubscription_NoDeliveryDelay</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub)</td></tr>
<tr class="memdesc:ga38f1e41fc7619101fc4aa52014dd5428"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables the No Delivery Delay mode.  <a href="group__sub_group.html#ga38f1e41fc7619101fc4aa52014dd5428">More...</a><br /></td></tr>
<tr class="separator:ga38f1e41fc7619101fc4aa52014dd5428"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6538a5d78dfb0f16514b94c8e74c11af"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga6538a5d78dfb0f16514b94c8e74c11af">natsSubscription_NextMsg</a> (<a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **nextMsg, <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int64_t timeout)</td></tr>
<tr class="memdesc:ga6538a5d78dfb0f16514b94c8e74c11af"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the next available message.  <a href="group__sub_group.html#ga6538a5d78dfb0f16514b94c8e74c11af">More...</a><br /></td></tr>
<tr class="separator:ga6538a5d78dfb0f16514b94c8e74c11af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaee87f8be0e6c2a4693ba2cea070583ba"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#gaee87f8be0e6c2a4693ba2cea070583ba">natsSubscription_Unsubscribe</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub)</td></tr>
<tr class="memdesc:gaee87f8be0e6c2a4693ba2cea070583ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unsubscribes.  <a href="group__sub_group.html#gaee87f8be0e6c2a4693ba2cea070583ba">More...</a><br /></td></tr>
<tr class="separator:gaee87f8be0e6c2a4693ba2cea070583ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga09f285de2746a6e27fc66efd60bd3116"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga09f285de2746a6e27fc66efd60bd3116">natsSubscription_AutoUnsubscribe</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int max)</td></tr>
<tr class="memdesc:ga09f285de2746a6e27fc66efd60bd3116"><td class="mdescLeft">&#160;</td><td class="mdescRight">Auto-Unsubscribes.  <a href="group__sub_group.html#ga09f285de2746a6e27fc66efd60bd3116">More...</a><br /></td></tr>
<tr class="separator:ga09f285de2746a6e27fc66efd60bd3116"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8a37b2d5290da3aecc05483d79e7e254"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga8a37b2d5290da3aecc05483d79e7e254">natsSubscription_QueuedMsgs</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, uint64_t *queuedMsgs)</td></tr>
<tr class="memdesc:ga8a37b2d5290da3aecc05483d79e7e254"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of pending messages.  <a href="group__sub_group.html#ga8a37b2d5290da3aecc05483d79e7e254">More...</a><br /></td></tr>
<tr class="separator:ga8a37b2d5290da3aecc05483d79e7e254"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga68a7cea89e75c529a7dd3bb77303dda4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga68a7cea89e75c529a7dd3bb77303dda4">natsSubscription_SetPendingLimits</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int msgLimit, int bytesLimit)</td></tr>
<tr class="memdesc:ga68a7cea89e75c529a7dd3bb77303dda4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the limit for pending messages and bytes.  <a href="group__sub_group.html#ga68a7cea89e75c529a7dd3bb77303dda4">More...</a><br /></td></tr>
<tr class="separator:ga68a7cea89e75c529a7dd3bb77303dda4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga786bb458981274fe717f266bd3b96d96"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga786bb458981274fe717f266bd3b96d96">natsSubscription_GetPendingLimits</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int *msgLimit, int *bytesLimit)</td></tr>
<tr class="memdesc:ga786bb458981274fe717f266bd3b96d96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the current limit for pending messages and bytes.  <a href="group__sub_group.html#ga786bb458981274fe717f266bd3b96d96">More...</a><br /></td></tr>
<tr class="separator:ga786bb458981274fe717f266bd3b96d96"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaca6262e2ef842caa701a9f233db72707"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#gaca6262e2ef842caa701a9f233db72707">natsSubscription_GetPending</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int *msgs, int *bytes)</td></tr>
<tr class="memdesc:gaca6262e2ef842caa701a9f233db72707"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of pending messages and bytes.  <a href="group__sub_group.html#gaca6262e2ef842caa701a9f233db72707">More...</a><br /></td></tr>
<tr class="separator:gaca6262e2ef842caa701a9f233db72707"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga476b7276d0b7f9946834d2bb2423e955"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga476b7276d0b7f9946834d2bb2423e955">natsSubscription_GetDelivered</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int64_t *msgs)</td></tr>
<tr class="memdesc:ga476b7276d0b7f9946834d2bb2423e955"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of delivered messages.  <a href="group__sub_group.html#ga476b7276d0b7f9946834d2bb2423e955">More...</a><br /></td></tr>
<tr class="separator:ga476b7276d0b7f9946834d2bb2423e955"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga24f1636869e26661ce62c9c9f4d80823"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga24f1636869e26661ce62c9c9f4d80823">natsSubscription_GetDropped</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int64_t *msgs)</td></tr>
<tr class="memdesc:ga24f1636869e26661ce62c9c9f4d80823"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of dropped messages.  <a href="group__sub_group.html#ga24f1636869e26661ce62c9c9f4d80823">More...</a><br /></td></tr>
<tr class="separator:ga24f1636869e26661ce62c9c9f4d80823"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0abc5d9afbc6b0c9c5adaf533904c968"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga0abc5d9afbc6b0c9c5adaf533904c968">natsSubscription_GetMaxPending</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int *msgs, int *bytes)</td></tr>
<tr class="memdesc:ga0abc5d9afbc6b0c9c5adaf533904c968"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the maximum number of pending messages and bytes.  <a href="group__sub_group.html#ga0abc5d9afbc6b0c9c5adaf533904c968">More...</a><br /></td></tr>
<tr class="separator:ga0abc5d9afbc6b0c9c5adaf533904c968"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafe31911d8372db401d33856465421710"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#gafe31911d8372db401d33856465421710">natsSubscription_ClearMaxPending</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub)</td></tr>
<tr class="memdesc:gafe31911d8372db401d33856465421710"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears the statistics regarding the maximum pending values.  <a href="group__sub_group.html#gafe31911d8372db401d33856465421710">More...</a><br /></td></tr>
<tr class="separator:gafe31911d8372db401d33856465421710"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga12b60cdb3aca7329edebc480ae86bfab"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga12b60cdb3aca7329edebc480ae86bfab">natsSubscription_GetStats</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int *pendingMsgs, int *pendingBytes, int *maxPendingMsgs, int *maxPendingBytes, int64_t *deliveredMsgs, int64_t *droppedMsgs)</td></tr>
<tr class="memdesc:ga12b60cdb3aca7329edebc480ae86bfab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get various statistics from this subscription.  <a href="group__sub_group.html#ga12b60cdb3aca7329edebc480ae86bfab">More...</a><br /></td></tr>
<tr class="separator:ga12b60cdb3aca7329edebc480ae86bfab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5e6454bbc7a90b9694112d45bd8de903"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga5e6454bbc7a90b9694112d45bd8de903">natsSubscription_IsValid</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub)</td></tr>
<tr class="memdesc:ga5e6454bbc7a90b9694112d45bd8de903"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks the validity of the subscription.  <a href="group__sub_group.html#ga5e6454bbc7a90b9694112d45bd8de903">More...</a><br /></td></tr>
<tr class="separator:ga5e6454bbc7a90b9694112d45bd8de903"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga26c9736289d326fb7d6df7e2a0df72ab"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga26c9736289d326fb7d6df7e2a0df72ab">natsSubscription_Drain</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub)</td></tr>
<tr class="memdesc:ga26c9736289d326fb7d6df7e2a0df72ab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Drains the subscription with a default timeout.  <a href="group__sub_group.html#ga26c9736289d326fb7d6df7e2a0df72ab">More...</a><br /></td></tr>
<tr class="separator:ga26c9736289d326fb7d6df7e2a0df72ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9c26a3f9584e7804060a48ec1b7e2a68"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga9c26a3f9584e7804060a48ec1b7e2a68">natsSubscription_DrainTimeout</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int64_t timeout)</td></tr>
<tr class="memdesc:ga9c26a3f9584e7804060a48ec1b7e2a68"><td class="mdescLeft">&#160;</td><td class="mdescRight">Drains the subscription with the specified timeout.  <a href="group__sub_group.html#ga9c26a3f9584e7804060a48ec1b7e2a68">More...</a><br /></td></tr>
<tr class="separator:ga9c26a3f9584e7804060a48ec1b7e2a68"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0408c9b6e4ad4078ac0267656ace222d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d">natsSubscription_WaitForDrainCompletion</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, int64_t timeout)</td></tr>
<tr class="memdesc:ga0408c9b6e4ad4078ac0267656ace222d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Blocks until the drain operation completes.  <a href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d">More...</a><br /></td></tr>
<tr class="separator:ga0408c9b6e4ad4078ac0267656ace222d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9834bd02f67a25ac084d5ad71e146019"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga9834bd02f67a25ac084d5ad71e146019">natsSubscription_DrainCompletionStatus</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub)</td></tr>
<tr class="memdesc:ga9834bd02f67a25ac084d5ad71e146019"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the status of the drain after completion.  <a href="group__sub_group.html#ga9834bd02f67a25ac084d5ad71e146019">More...</a><br /></td></tr>
<tr class="separator:ga9834bd02f67a25ac084d5ad71e146019"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaea632f845d473e7461b134c0e7bf4077"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#gaea632f845d473e7461b134c0e7bf4077">natsSubscription_SetOnCompleteCB</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub, <a class="el" href="group__callbacks_group.html#ga245131e64f1d0dff7edc8ed874a07e9a">natsOnCompleteCB</a> cb, void *closure)</td></tr>
<tr class="memdesc:gaea632f845d473e7461b134c0e7bf4077"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets a completion callback.  <a href="group__sub_group.html#gaea632f845d473e7461b134c0e7bf4077">More...</a><br /></td></tr>
<tr class="separator:gaea632f845d473e7461b134c0e7bf4077"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga50a95dd96e9b714201679a015d62832f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__sub_group.html#ga50a95dd96e9b714201679a015d62832f">natsSubscription_Destroy</a> (<a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *sub)</td></tr>
<tr class="memdesc:ga50a95dd96e9b714201679a015d62832f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys the subscription.  <a href="group__sub_group.html#ga50a95dd96e9b714201679a015d62832f">More...</a><br /></td></tr>
<tr class="separator:ga50a95dd96e9b714201679a015d62832f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p >NATS Subscriptions. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga38f1e41fc7619101fc4aa52014dd5428" name="ga38f1e41fc7619101fc4aa52014dd5428"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga38f1e41fc7619101fc4aa52014dd5428">&#9670;&nbsp;</a></span>natsSubscription_NoDeliveryDelay()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_NoDeliveryDelay </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >By default, messages that arrive are not immediately delivered. This generally improves performance. However, in case of request-reply, this delay has a negative impact. In such case, call this function to have the subscriber be notified immediately each time a message arrives.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object.</td></tr>
  </table>
  </dd>
</dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated:</a></b></dt><dd>No longer needed. Will be removed in the future. </dd></dl>

</div>
</div>
<a id="ga6538a5d78dfb0f16514b94c8e74c11af" name="ga6538a5d78dfb0f16514b94c8e74c11af"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6538a5d78dfb0f16514b94c8e74c11af">&#9670;&nbsp;</a></span>natsSubscription_NextMsg()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_NextMsg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **&#160;</td>
          <td class="paramname"><em>nextMsg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Return the next message available to a synchronous subscriber or block until one is available. A timeout (expressed in milliseconds) can be used to return when no message has been delivered. If the value is zero, then this call will not wait and return the next message that was pending in the client, and <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80ab88994c9ea9889ac4d9d656d62f550ed">NATS_TIMEOUT</a> otherwise.</p>
<dl class="section note"><dt>Note</dt><dd>If you create a subscription for a subject used as the reply subject of a <a class="el" href="group__conn_pub_group.html#gaaaa3d75ffec2dcdc6bf905cdb1eee59e" title="Publishes data on a subject expecting replies on the given reply.">natsConnection_PublishRequest</a> call (or any of its variant), and there are no responders for the request subject, NATS Servers v2.2.0+ will return an empty message with a header "Status" and value "503". The library v2.2.0 until v2.4.1 would return this message to the user, which was wrong.<br  />
 The library now returns no message and <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80aab97324e40ccfe1360080c651c330e62" title="No responders were running when the server received the request.">NATS_NO_RESPONDERS</a> status.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nextMsg</td><td>the location where to store the pointer to the next available message. </td></tr>
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">timeout</td><td>time, in milliseconds, after which this call will return <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80ab88994c9ea9889ac4d9d656d62f550ed">NATS_TIMEOUT</a> if no message is available. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaee87f8be0e6c2a4693ba2cea070583ba" name="gaee87f8be0e6c2a4693ba2cea070583ba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaee87f8be0e6c2a4693ba2cea070583ba">&#9670;&nbsp;</a></span>natsSubscription_Unsubscribe()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_Unsubscribe </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Removes interest on the subject. Asynchronous subscription may still have a callback in progress, in that case, the subscription will still be valid until the callback returns.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga09f285de2746a6e27fc66efd60bd3116" name="ga09f285de2746a6e27fc66efd60bd3116"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga09f285de2746a6e27fc66efd60bd3116">&#9670;&nbsp;</a></span>natsSubscription_AutoUnsubscribe()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_AutoUnsubscribe </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >This call issues an automatic <a class="el" href="group__sub_group.html#gaee87f8be0e6c2a4693ba2cea070583ba" title="Unsubscribes.">natsSubscription_Unsubscribe</a> that is processed by the server when 'max' messages have been received. This can be useful when sending a request to an unknown number of subscribers.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">max</td><td>the maximum number of message you want this subscription to receive. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga8a37b2d5290da3aecc05483d79e7e254" name="ga8a37b2d5290da3aecc05483d79e7e254"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8a37b2d5290da3aecc05483d79e7e254">&#9670;&nbsp;</a></span>natsSubscription_QueuedMsgs()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_QueuedMsgs </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t *&#160;</td>
          <td class="paramname"><em>queuedMsgs</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Returns the number of queued messages in the client for this subscription.</p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000002">Deprecated:</a></b></dt><dd>Use <a class="el" href="group__sub_group.html#gaca6262e2ef842caa701a9f233db72707" title="Returns the number of pending messages and bytes.">natsSubscription_GetPending</a> instead.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">queuedMsgs</td><td>the location where to store the number of queued messages. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga68a7cea89e75c529a7dd3bb77303dda4" name="ga68a7cea89e75c529a7dd3bb77303dda4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga68a7cea89e75c529a7dd3bb77303dda4">&#9670;&nbsp;</a></span>natsSubscription_SetPendingLimits()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_SetPendingLimits </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>msgLimit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>bytesLimit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Specifies the maximum number and size of incoming messages that can be buffered in the library for this subscription, before new incoming messages are dropped and <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80ae93ff5b7fe31f8570308385d92d317b0">NATS_SLOW_CONSUMER</a> status is reported to the <a class="el" href="group__callbacks_group.html#ga9e511dffa471dfb971b7dd2b12329626" title="Callback used to notify the user of errors encountered while processing inbound messages.">natsErrHandler</a> callback (if one has been set).</p>
<p >If no limit is set at the subscription level, the limit set by <a class="el" href="group__opts_group.html#ga95510436eee06f9992ded96a44795c40" title="Sets the maximum number of pending messages per subscription.">natsOptions_SetMaxPendingMsgs</a> before creating the connection will be used.</p>
<dl class="section note"><dt>Note</dt><dd>If no option is set, there is still a default of <code>65536</code> messages and <code>65536 * 1024</code> bytes.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__opts_group.html#ga95510436eee06f9992ded96a44795c40" title="Sets the maximum number of pending messages per subscription.">natsOptions_SetMaxPendingMsgs</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga786bb458981274fe717f266bd3b96d96" title="Returns the current limit for pending messages and bytes.">natsSubscription_GetPendingLimits</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>he pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">msgLimit</td><td>the limit in number of messages that the subscription can hold. </td></tr>
    <tr><td class="paramname">bytesLimit</td><td>the limit in bytes that the subscription can hold. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga786bb458981274fe717f266bd3b96d96" name="ga786bb458981274fe717f266bd3b96d96"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga786bb458981274fe717f266bd3b96d96">&#9670;&nbsp;</a></span>natsSubscription_GetPendingLimits()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_GetPendingLimits </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>msgLimit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>bytesLimit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Regardless if limits have been explicitly set with <a class="el" href="group__sub_group.html#ga68a7cea89e75c529a7dd3bb77303dda4" title="Sets the limit for pending messages and bytes.">natsSubscription_SetPendingLimits</a>, this call will store in the provided memory locations, the limits set for this subscription.</p>
<dl class="section note"><dt>Note</dt><dd>It is possible for <code>msgLimit</code> and/or <code>bytesLimits</code> to be <code>NULL</code>, in which case the corresponding value is obviously not stored, but the function will not return an error.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__opts_group.html#ga95510436eee06f9992ded96a44795c40" title="Sets the maximum number of pending messages per subscription.">natsOptions_SetMaxPendingMsgs</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga68a7cea89e75c529a7dd3bb77303dda4" title="Sets the limit for pending messages and bytes.">natsSubscription_SetPendingLimits</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">msgLimit</td><td>if not <code>NULL</code>, the memory location where to store the maximum number of pending messages for this subscription. </td></tr>
    <tr><td class="paramname">bytesLimit</td><td>if not <code>NULL</code>, the memory location where to store the maximum size of pending messages for this subscription. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaca6262e2ef842caa701a9f233db72707" name="gaca6262e2ef842caa701a9f233db72707"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaca6262e2ef842caa701a9f233db72707">&#9670;&nbsp;</a></span>natsSubscription_GetPending()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_GetPending </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>msgs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Returns the total number and size of pending messages on this subscription.</p>
<dl class="section note"><dt>Note</dt><dd>It is possible for <code>msgs</code> and <code>bytes</code> to be NULL, in which case the corresponding values are obviously not stored, but the function will not return an error.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">msgs</td><td>if not <code>NULL</code>, the memory location where to store the number of pending messages. </td></tr>
    <tr><td class="paramname">bytes</td><td>if not <code>NULL</code>, the memory location where to store the total size of pending messages. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga476b7276d0b7f9946834d2bb2423e955" name="ga476b7276d0b7f9946834d2bb2423e955"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga476b7276d0b7f9946834d2bb2423e955">&#9670;&nbsp;</a></span>natsSubscription_GetDelivered()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_GetDelivered </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t *&#160;</td>
          <td class="paramname"><em>msgs</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Returns the number of delivered messages for this subscription.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">msgs</td><td>the memory location where to store the number of delivered messages. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga24f1636869e26661ce62c9c9f4d80823" name="ga24f1636869e26661ce62c9c9f4d80823"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga24f1636869e26661ce62c9c9f4d80823">&#9670;&nbsp;</a></span>natsSubscription_GetDropped()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_GetDropped </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t *&#160;</td>
          <td class="paramname"><em>msgs</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Returns the number of known dropped messages for this subscription. This happens when a consumer is not keeping up and the library starts to drop messages when the maximum number (and/or size) of pending messages has been reached.</p>
<dl class="section note"><dt>Note</dt><dd>If the server declares the connection a slow consumer, this number may not be valid.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__opts_group.html#ga95510436eee06f9992ded96a44795c40" title="Sets the maximum number of pending messages per subscription.">natsOptions_SetMaxPendingMsgs</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga68a7cea89e75c529a7dd3bb77303dda4" title="Sets the limit for pending messages and bytes.">natsSubscription_SetPendingLimits</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">msgs</td><td>the memory location where to store the number of dropped messages. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga0abc5d9afbc6b0c9c5adaf533904c968" name="ga0abc5d9afbc6b0c9c5adaf533904c968"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0abc5d9afbc6b0c9c5adaf533904c968">&#9670;&nbsp;</a></span>natsSubscription_GetMaxPending()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_GetMaxPending </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>msgs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Returns the maximum of pending messages and bytes seen so far.</p>
<dl class="section note"><dt>Note</dt><dd><code>msgs</code> and/or <code>bytes</code> can be NULL.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">msgs</td><td>if not <code>NULL</code>, the memory location where to store the maximum number of pending messages seen so far. </td></tr>
    <tr><td class="paramname">bytes</td><td>if not <code>NULL</code>, the memory location where to store the maximum number of bytes pending seen so far. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gafe31911d8372db401d33856465421710" name="gafe31911d8372db401d33856465421710"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafe31911d8372db401d33856465421710">&#9670;&nbsp;</a></span>natsSubscription_ClearMaxPending()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_ClearMaxPending </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Clears the statistics regarding the maximum pending values.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga12b60cdb3aca7329edebc480ae86bfab" name="ga12b60cdb3aca7329edebc480ae86bfab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga12b60cdb3aca7329edebc480ae86bfab">&#9670;&nbsp;</a></span>natsSubscription_GetStats()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_GetStats </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>pendingMsgs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>pendingBytes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>maxPendingMsgs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>maxPendingBytes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t *&#160;</td>
          <td class="paramname"><em>deliveredMsgs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t *&#160;</td>
          <td class="paramname"><em>droppedMsgs</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >This is a convenient function to get several subscription's statistics in one call.</p>
<dl class="section note"><dt>Note</dt><dd>Any or all of the statistics pointers can be <code>NULL</code>.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__sub_group.html#gaca6262e2ef842caa701a9f233db72707" title="Returns the number of pending messages and bytes.">natsSubscription_GetPending</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga0abc5d9afbc6b0c9c5adaf533904c968" title="Returns the maximum number of pending messages and bytes.">natsSubscription_GetMaxPending</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga476b7276d0b7f9946834d2bb2423e955" title="Returns the number of delivered messages.">natsSubscription_GetDelivered</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga24f1636869e26661ce62c9c9f4d80823" title="Returns the number of dropped messages.">natsSubscription_GetDropped</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">pendingMsgs</td><td>if not <code>NULL</code>, memory location where to store the number of pending messages. </td></tr>
    <tr><td class="paramname">pendingBytes</td><td>if not <code>NULL</code>, memory location where to store the total size of pending messages. </td></tr>
    <tr><td class="paramname">maxPendingMsgs</td><td>if not <code>NULL</code>, memory location where to store the maximum number of pending messages seen so far. </td></tr>
    <tr><td class="paramname">maxPendingBytes</td><td>if not <code>NULL</code>, memory location where to store the maximum total size of pending messages seen so far. </td></tr>
    <tr><td class="paramname">deliveredMsgs</td><td>if not <code>NULL</code>, memory location where to store the number of delivered messages. </td></tr>
    <tr><td class="paramname">droppedMsgs</td><td>if not <code>NULL</code>, memory location where to store the number of dropped messages. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga5e6454bbc7a90b9694112d45bd8de903" name="ga5e6454bbc7a90b9694112d45bd8de903"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5e6454bbc7a90b9694112d45bd8de903">&#9670;&nbsp;</a></span>natsSubscription_IsValid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> bool natsSubscription_IsValid </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Returns a boolean indicating whether the subscription is still active. This will return false if the subscription has already been closed, or auto unsubscribed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga26c9736289d326fb7d6df7e2a0df72ab" name="ga26c9736289d326fb7d6df7e2a0df72ab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga26c9736289d326fb7d6df7e2a0df72ab">&#9670;&nbsp;</a></span>natsSubscription_Drain()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_Drain </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Drain will remove interest but continue to invoke callbacks until all messages have been processed.</p>
<p >This call uses a default drain timeout of 30 seconds. See <a class="el" href="group__sub_group.html#ga9c26a3f9584e7804060a48ec1b7e2a68" title="Drains the subscription with the specified timeout.">natsSubscription_DrainTimeout</a> for details on behavior when timeout elapses.</p>
<dl class="section warning"><dt>Warning</dt><dd>This function does not block waiting for the operation to complete. To synchronously wait, see <a class="el" href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d" title="Blocks until the drain operation completes.">natsSubscription_WaitForDrainCompletion</a></dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__sub_group.html#ga9c26a3f9584e7804060a48ec1b7e2a68" title="Drains the subscription with the specified timeout.">natsSubscription_DrainTimeout</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d" title="Blocks until the drain operation completes.">natsSubscription_WaitForDrainCompletion</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga9834bd02f67a25ac084d5ad71e146019" title="Returns the status of the drain after completion.">natsSubscription_DrainCompletionStatus</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga9c26a3f9584e7804060a48ec1b7e2a68" name="ga9c26a3f9584e7804060a48ec1b7e2a68"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9c26a3f9584e7804060a48ec1b7e2a68">&#9670;&nbsp;</a></span>natsSubscription_DrainTimeout()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_DrainTimeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Drain will remove interest but continue to invoke callbacks until all messages have been processed, or the specified timeout has elapsed. In that case, the subscription will be forcibly closed and remaining pending messages (if any) will not be processed.</p>
<p >The timeout is expressed in milliseconds. Zero or negative value means that the call will not timeout, but see below for more details.</p>
<p >When this call returns, the UNSUBSCRIBE protocol for this subscription has been enqueued to the outgoing connection buffer, but not sent to the server, ensuring that this call does not block.</p>
<p >The library then asynchronously ensures that this protocol is sent and waits for a confirmation from the server. After that, it is guaranteed that no new message for this subscription will be received and the library can proceed with the rest of the draining.</p>
<p >However, should the "flush" of the protocol fail, the library will ensure that no new message is added to the subscription (in the event the server did not receive the UNSUBSCRIBE protocol and still attempts to deliver messages), and will proceed with the draining of the pending messages. Users can check the status of the draining after it has completed by calling <a class="el" href="group__sub_group.html#ga9834bd02f67a25ac084d5ad71e146019" title="Returns the status of the drain after completion.">natsSubscription_DrainCompletionStatus</a>.</p>
<p >If no timeout is specified (that is, value is zero or negative), a timeout will be used for the "flush" of the protocol. Again, even in case of failure, the draining will proceed.</p>
<p >If a timeout is specified, the complete process: "flush" of the protocol and draining of messages, must happen before the timeout elapses otherwise the subscription will be forcibly closed, and not all message callbacks may be invoked.</p>
<p >Regardless of the presence of a timeout or not, should the subscription or connection be closed while draining occurs, the draining process will stop. The <a class="el" href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d" title="Blocks until the drain operation completes.">natsSubscription_WaitForDrainCompletion</a> call will not report an error. To know if an error occurred, the user can call <a class="el" href="group__sub_group.html#ga9834bd02f67a25ac084d5ad71e146019" title="Returns the status of the drain after completion.">natsSubscription_DrainCompletionStatus</a> after ensuring that the drain has completed.</p>
<dl class="section warning"><dt>Warning</dt><dd>This function does not block waiting for the operation to complete. To synchronously wait, see <a class="el" href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d" title="Blocks until the drain operation completes.">natsSubscription_WaitForDrainCompletion</a></dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__sub_group.html#ga26c9736289d326fb7d6df7e2a0df72ab" title="Drains the subscription with a default timeout.">natsSubscription_Drain</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d" title="Blocks until the drain operation completes.">natsSubscription_WaitForDrainCompletion</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga9834bd02f67a25ac084d5ad71e146019" title="Returns the status of the drain after completion.">natsSubscription_DrainCompletionStatus</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">timeout</td><td>how long to wait for the operation to complete, expressed in milliseconds. If the timeout elapses the subscription will be closed. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga0408c9b6e4ad4078ac0267656ace222d" name="ga0408c9b6e4ad4078ac0267656ace222d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0408c9b6e4ad4078ac0267656ace222d">&#9670;&nbsp;</a></span>natsSubscription_WaitForDrainCompletion()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_WaitForDrainCompletion </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >This function blocks until the subscription is fully drained. Returns no error if the subscription is drained or closed, otherwise returns the error if the subscription was not in drained mode (<a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80a9bb78b4f245d2870040d25c450febd4b">NATS_ILLEGAL_STATE</a>) or if this subscription was not drained or closed prior to the specified timeout (<a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80ab88994c9ea9889ac4d9d656d62f550ed">NATS_TIMEOUT</a>).</p>
<p >The timeout is expressed in milliseconds. Zero or negative value means that the call will not timeout.</p>
<p >Note that if this call times-out, it does not mean that the drain stops. The drain will continue until its own timeout elapses.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__sub_group.html#ga26c9736289d326fb7d6df7e2a0df72ab" title="Drains the subscription with a default timeout.">natsSubscription_Drain</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga9c26a3f9584e7804060a48ec1b7e2a68" title="Drains the subscription with the specified timeout.">natsSubscription_DrainTimeout</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga9834bd02f67a25ac084d5ad71e146019" title="Returns the status of the drain after completion.">natsSubscription_DrainCompletionStatus</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
    <tr><td class="paramname">timeout</td><td>how long to wait for the operation to complete, expressed in milliseconds. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga9834bd02f67a25ac084d5ad71e146019" name="ga9834bd02f67a25ac084d5ad71e146019"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9834bd02f67a25ac084d5ad71e146019">&#9670;&nbsp;</a></span>natsSubscription_DrainCompletionStatus()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_DrainCompletionStatus </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Once the drain has completed, users can use this function to know if the drain completed successfully or not.</p>
<p >Possible return values (the list is not exhaustive):</p>
<p ><code>NATS_OK</code> the library sent the UNSUBSCRIBE protocol and finished processing all messages that were pending.<br  />
 <code>NATS_ILLEGAL_STATE</code> this call was made for a subscription that had not started draining or the draining is still in progress.<br  />
 <code>NATS_INVALID_SUBSCRIPTION</code> the subscription was closed while draining, which means that some messages may not have been processed.<br  />
 <code>NATS_CONNECTION_CLOSED</code> the connection was closed while draining, which means that some messages may not have been processed.</p>
<dl class="section note"><dt>Note</dt><dd>This call does not wait for the drain completion (see <a class="el" href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d" title="Blocks until the drain operation completes.">natsSubscription_WaitForDrainCompletion</a> for that).</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__sub_group.html#ga26c9736289d326fb7d6df7e2a0df72ab" title="Drains the subscription with a default timeout.">natsSubscription_Drain</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga9c26a3f9584e7804060a48ec1b7e2a68" title="Drains the subscription with the specified timeout.">natsSubscription_DrainTimeout</a> </dd>
<dd>
<a class="el" href="group__sub_group.html#ga0408c9b6e4ad4078ac0267656ace222d" title="Blocks until the drain operation completes.">natsSubscription_WaitForDrainCompletion</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaea632f845d473e7461b134c0e7bf4077" name="gaea632f845d473e7461b134c0e7bf4077"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaea632f845d473e7461b134c0e7bf4077">&#9670;&nbsp;</a></span>natsSubscription_SetOnCompleteCB()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsSubscription_SetOnCompleteCB </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__callbacks_group.html#ga245131e64f1d0dff7edc8ed874a07e9a">natsOnCompleteCB</a>&#160;</td>
          <td class="paramname"><em>cb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>closure</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >In order to make sure that an asynchronous subscription's message handler is no longer invoked once the subscription is closed (<a class="el" href="group__sub_group.html#gaee87f8be0e6c2a4693ba2cea070583ba" title="Unsubscribes.">natsSubscription_Unsubscribe</a>), the subscription should be closed from the message handler itslef.</p>
<p >If the application closes the subscription from a different thread and immediately frees resources needed in the message handler, there is a risk of a crash since the subscription's message handler may still be invoked one last time or already in the process of executing.</p>
<p >To address this, the user can set a callback that will be invoked after the subscription is closed and the message handler has returned. This applies to asynchronous subscriptions using their own dispatcher or using the library's delivery thread pool.</p>
<dl class="section note"><dt>Note</dt><dd>You don't need to call this function if you are not freeing resources needed in the message handler or if you always close the subscription from the message handler itself.</dd>
<dd>
If you plan on calling this function, you should do so before calling <a class="el" href="group__sub_group.html#ga09f285de2746a6e27fc66efd60bd3116" title="Auto-Unsubscribes.">natsSubscription_AutoUnsubscribe</a>, since there is a risk that the subscription be removed as soon as <a class="el" href="group__sub_group.html#ga09f285de2746a6e27fc66efd60bd3116" title="Auto-Unsubscribes.">natsSubscription_AutoUnsubscribe</a> returns.</dd></dl>
<p>Calling this function on a synchronous or closed subscription will return <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80a273e92a0ff3b7eaf946b4b7fa6cc6c6c">NATS_INVALID_SUBSCRIPTION</a>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__callbacks_group.html#ga245131e64f1d0dff7edc8ed874a07e9a" title="Callback used to notify that an object lifecycle is complete.">natsOnCompleteCB</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object </td></tr>
    <tr><td class="paramname">cb</td><td>the callback to invoke when the last message of a closed subscription has been dispatched </td></tr>
    <tr><td class="paramname">closure</td><td>the pointer to a user defined object (possibly <code>NULL</code>) that will be passed to the callback </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga50a95dd96e9b714201679a015d62832f" name="ga50a95dd96e9b714201679a015d62832f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga50a95dd96e9b714201679a015d62832f">&#9670;&nbsp;</a></span>natsSubscription_Destroy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> void natsSubscription_Destroy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8">natsSubscription</a> *&#160;</td>
          <td class="paramname"><em>sub</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Destroys the subscription object, freeing up memory. If not already done, this call will removes interest on the subject.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sub</td><td>the pointer to the <a class="el" href="group__types_group.html#ga87158ec63b4f90f69e20451624ea01d8" title="Interest on a given subject.">natsSubscription</a> object to destroy. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.10-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">NATS.IO Supported By Synadia Communications Inc.
    <a href="http://www.nats.io">
    </a></li>
  </ul>
</div>
</body>
</html>
